<?php

namespace app\index\controller;

use Alipay\Alipay as AlipaySdk;

/**
 * 
 * 文件用途描述: 
 * @authors xiaohui
 * @date    2018-02-02 17:11:30
 */
class Alipay extends Base
{
    
    /**
     * [index]
     * 函数用途描述: 调用支付宝支付
     * @date:  2018-02-02
     * @author: xiaohui
     * @param: [variable]
     * @return [type]     [description]
     */
    public function index()
    {
        if ($this->request->isPost()) {
            // 获取扩展配置 支付宝配置   config/index/extra/alipay.php
            $aliPayConfig = config('alipay');
            // 实例化支付宝支付类
            $alipay = new AlipaySdk($aliPayConfig);
            // 配置订单信息 
            $params = array(
                'title' => '服务端生成订单加签字符串',
                'money' => 0.01,
                'online_num' => time(),
                'body' => 'test'
            );
            $redata = $alipay->makeOrderString($params);
            return $redata;
        }
    }
}